<?php
/*
	页面顶部
*/	
class top_model extends Base_Model{
	/*
		渲染top视图
		返回要输出的视图字符串
		@return string
	*/
	public function render(){
		$data['site'] = $this->load->get_var('site');

		//载入顶部导航数据
		$data['nav'] = $this->load_nav('topnav');

		//载入用户数据
		$this->load->model('user_model');
		$data['user'] = $this->user_model->get_user( sess('uid') , 'uid');

		return $this->load->view('top.php',$data,true);
	}

	/*
		载入导航数组
		@url  导航数组文件名（不含后缀）
	*/
	public function load_nav($url){
		if( $url ){
			require_once APPPATH.'libraries/'.$url.'.php';
			return $nav;
		}else{
			show_error( $url.'无法载入');
		}
	}

	

}
